<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="送检账户" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="task-form-complete" class="form-horizontal">
    <h4 class="form-header h4"><@ctx.i18n text = "基本信息"/></h4>

    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送检账户编号"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="inspectionAccount" value="" type="text"  readonly >
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送样人"/>：</label>
                <div class="col-sm-8">
                    <@f.tableselect checked=false keyId="userName" keyName="userName" url="/pms/participantUser/list"
                    name="inspectionUser" boxTitle="送样人" tableInfo = "[{field:'userCode',title:'人员编号'},
                    {field:'userName',title:'人员姓名'}, {field:'iphone',title:'人员电话'},{field:'participantUnit',title:'所属单位'}]"
                    placeholder="请选择送样人" />
                    <!--<input class="form-control" name="inspectionUser" value="" type="text"  >-->
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送检单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="inspectionUnit" value="" labelValue="" url="pms/participant/list"  checked=false
                        keyId="participantName" keyName="participantName"  boxTitle="请选择送检单位"
                        tableInfo = "[{field:'participantCode',title:'编号'},{field:'participantName',title:'名称',query: true}]"
                        placeholder="请选择送检单位" />
                        <!--<input class="form-control" name="inspectionUnit" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "工程名称"/>：</label>
                <div class="col-sm-8">
                    <@f.tableselect name="projectName" value="" labelValue=""   url="pms/participant/list"  checked=false keyId="projectName"
                    keyName="projectName"  boxTitle="请选择工程名称"
                    tableInfo = "[{field:'projectCode',title:'编号'},{field:'projectType',title:'工程类别',dict:'project_type',query: true},{field:'projectName',title:'名称',query: true}]"
                    placeholder="请选择工程名称" />
                    <input  name="region" value="" type="text"  hidden>
                    <input  name="projectType" value="" type="text"  hidden>
                    <input  name="testingIndustry" value="" type="text"  hidden>
                </div>
            </div>
        </div>
    </div>

    <div class="row">

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "见证人"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="witness" value="" labelValue=""   url="pms/participantUser/list"  checked=false keyId="userName"
                        keyName="userName"  boxTitle="请选择见证人"
                        tableInfo = "[{field:'userCode',title:'编号'},{field:'userName',title:'名称',query: true}]"
                        placeholder="请选择见证人" />
                        <!--<input class="form-control" name="witness" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "见证单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="witnessUnit" value="" labelValue=""   url="pms/participant/list"  checked=false keyId="participantName"
                        keyName="participantName"  boxTitle="请选择见证单位"
                        tableInfo = "[{field:'participantCode',title:'编号'},{field:'participantName',title:'名称',query: true}]"
                        placeholder="请选择见证单位" />
                        <!--<input class="form-control" name="witnessUnit" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>

    </div>

    <div class="row">

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "抽样人"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="samplers" value="" labelValue=""   url="pms/participantUser/list"  checked=false keyId="userName"
                        keyName="userName"  boxTitle="请选择抽样人"
                        tableInfo = "[{field:'userCode',title:'编号'},{field:'userName',title:'名称',query: true}]"
                        placeholder="请选择抽样人" />
                        <!--<input class="form-control" name="samplers" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "抽样单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="samplersUnit" value="" labelValue=""   url="pms/participant/list"  checked=false keyId="participantName"
                        keyName="participantName"  boxTitle="请选择抽样单位"
                        tableInfo = "[{field:'participantCode',title:'编号'},{field:'participantName',title:'名称',query: true}]"
                        placeholder="请选择抽样单位" />
                        <!--<input class="form-control" name="samplersUnit" value="" type="text"  >-->
                    </div>
                </div>
            </div>

    </div>
    </div>

    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "建设单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="buildUnit" value="" labelValue=""   url="pms/participant/list"  checked=false keyId="participantName"
                        keyName="participantName"  boxTitle="请选择建设单位"
                        tableInfo = "[{field:'participantCode',title:'编号'},{field:'participantName',title:'名称',query: true}]"
                        placeholder="请选择建设单位" />
                        <!--<input class="form-control" name="buildUnit" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "施工单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="constructionUnit" value="" labelValue=""   url="pms/participant/list"  checked=false keyId="participantName"
                        keyName="participantName"  boxTitle="请选择施工单位"
                        tableInfo = "[{field:'participantCode',title:'编号'},{field:'participantName',title:'名称',query: true}]"
                        placeholder="请选择施工单位" />
                        <!--<input class="form-control" name="constructionUnit" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>

    </div>

    <div class="row">

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="entrustUnit" value="" labelValue=""   url="pms/participant/list"  checked=false keyId="participantName"
                        keyName="participantName"  boxTitle="请选择委托单位"
                        tableInfo = "[{field:'participantCode',title:'编号'},{field:'participantName',title:'名称',query: true}]"
                        placeholder="请选择委托单位" />
                        <!--<input class="form-control" name="entrustUnit" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托方联系人"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="entrustContacts" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

    </div>

    <div class="row">

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "报告邮寄地址"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="address" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "账户状态"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.radio name="status" dictType="project_status" value="0"/>
                        <!--<input class="form-control" name="status" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>





    </div>


</div>




</@f.form>
<div class="hr-line-dashed"></div>
<div class="row" style="text-align: center;" id="_addTab">
    <!--<button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;-->
    <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
    <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
</div>
</div>
<@footer>
<script type="text/javascript">
    var prefix = baseURL + "pms/inspectionAccount";

    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });

    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "projectName"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];
            $("input[name=region]").val(data.region);
            $("input[name=projectType]").val(data.projectType);
            $("input[name=testingIndustry]").val(data.testingIndustry);

        }
    }

    function submitHandler() {

       //  var arrivalAmount= parseFloat($('input[name="arrivalAmount"]').val());
       //  var claimAmount= parseFloat($('input[name="claimAmount"]').val());
       //  console.log(arrivalAmount);
       //  console.log(claimAmount);
       //  console.log(claimAmount>arrivalAmount);
       // if(claimAmount>arrivalAmount){
       //   //  alert("已认领金额不能大于到账金额");
       //   return  opt.modal.alertWarning("已认领金额不能大于到账金额");
       // }

        if (opt.validate.form()) {
            opt.operate.saveTab(prefix + "/add", $('#task-form-complete').serialize());
        }
    }
</script>
</@footer>
</@pageTheme>